import Vue from 'vue'
import VueRouter from 'vue-router'
import LayoutView from '@/views/MyView/LayoutView'
Vue.use(VueRouter)

const routes = [
  {//重定向到首页
    path: '/',
    redirect: '/main',
  },
  {//注册
    path: '/register',
    component: () => import('@/views/Login/ZhuceView.vue')
  },
  {//商品分类
    path: '/classify',
    component: () => import('@/views/Classify')
  },
  {//登录
    path:'/login',
    component: () => import('@/views/Login/LogoinView.vue')
  },
  {//首页
    path: '/main',
    component: () => import('@/views/Main')
  },
  {//详情
    path: '/detail',
    component: () => import('@/views/Detail')
  },
  {//特卖
    path: '/temai',
    component: () => import('@/views/Temai')
  },
  {//评论
    path: '/discuss',
    component: () => import('@/views/Discuss')
  }, 
  {//今日秒杀
    path: '/today',
    component: () => import('@/views/Today')
  },
  {//优选
    path: '/youxuan',
    component: () => import('@/views/Temai')
  },
  {
    // 购物车
    path: '/cart',
    component: () => import('@/views/cartlist.vue')
  },
  {
    // 确认订单
    path: '/makesure',
    component: () => import('@/views/confirminganorder.vue')
  },
  {
    // 发送评论
    path: '/sendanswer',
    component: () => import('@/views/sendanswer.vue'),
  },
  {
    // 售后申请退款
    path: '/ApplicationOfRefund',
    component: () => import('@/views/ApplicationOfRefund.vue')
  },
  {
    path: '/return',
    component: () => import('@/views/returnmain.vue'),
    children:[
      {
        // 仅退款
        path: '/returnmoney',
        component: () => import('@/views/returnmoney.vue')
      },
      {
        // 退货退款
        path: '/returnshop',
        component: () => import('@/views/returnshop.vue')
      },
    ]
  },
  {
    path: '/news',
    component: () => import('@/views/Massage/Layout/news.vue')
  },
  {
    path: '/logis',
    component: () => import('@/views/Massage/Layout/LoginOut.vue')
  },
  {
    path: '/notice',
    component: () => import('@/views/Massage/Layout/MessageNotice.vue')
  },
  {
    path: '/message',
    component: () => import('@/views/Massage/Layout/MessageList.vue')
  },
  {
    path: '/Dialog',
    component: () => import('@/views/Massage/Layout/DialogBox.vue')
  },
  {
    path: '/refund',
    component: () => import('@/views/Massage/Layout/Refund.vue')
  },
  //我的
  {
    path: '/mine',
    name: 'mine',
    component: LayoutView
  },
  {
    path: '/setup',
    name: 'setup',
    component: () => import('@/views/MySet/SetView')
  },
  {
    path: '/setuserinfo',
    name: 'setuserinfo',
    component: () => import('@/views/MySet/SetUserInfo')
  },
  {
    path: '/choseaddress',
    component: () => import('@/views/MySet/ChoseAddress')

  },
  {
    path: '/setaddress/:id',
    name: 'setaddress',
    component: () => import('@/views/MySet/SetAddress')
  },
  {
    path: '/addaddress',
    name: 'addaddress',
    component: () => import('@/views/MySet/AddAddress')
  },
  {
    path: '/setusername',
    name: 'setusername',
    component: () => import('@/views/MySet/SetUsername')
  },
  {
    path: '/setdesc',
    name: 'setdesc',
    component: () => import('@/views/MySet/SetDesc')
  },
  {
    path: '/member',
    name: 'member',
    component: () => import('@/views/Member')
  },
  {
    path: '/coupon',
    name: 'coupon',
    component: () => import('@/views/Coupon')
  },
  {
    path: '/integral',
    name: 'integral',
    component: () => import('@/views/Integral')
  },
  {
    path: '/isnull',
    name: 'isnull',
    component: () => import('@/views/MyView/IsNull')
  },
  {
    path: '/myorderlist',
    name: 'myorder',
    component: () => import('@/views/MyOrder/MyOrderList'),
    redirect: '/allorders',
    children: [
      {
        path: '/allorders',
        name: 'allorders',
        component: () => import('@/views/MyOrder/AllOrders')
      },
      {
        path: '/topay',
        name: 'topay',
        component: () => import('@/views/MyOrder/ToPay')
      },
      {
        path: '/toship',
        name: 'toship',
        component: () => import('@/views/MyOrder/ToShip')
      },
      {
        path: '/toreceive',
        name: 'toreceive',
        component: () => import('@/views/MyOrder/ToReceive')
      },
      {
        path: '/toappraise',
        name: 'toappraise',
        component: () => import('@/views/MyOrder/ToAppraise')
      }
    ]
  }
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
